package com.finance.util;

/**
 * 数据类型枚举
 */
public enum DataType {
    C01("C01", "影票订单数据"),
    C02("C02", "商品订单数据"),
    C03("C03", "发卡数据"),
    C04("C04", "卡充值数据"),
    C05("C05", "卡消费数据"),
    C06("C06", "券回兑数据"),
    C07("C07", "商品进销存数据"),
    C08("C08", "商品出入库数据"),
    C09("C09", "销售消耗原材料数据"),
    C10("C10", "销售消耗品项数据"),
    C11("C11", "会员卡续费数据"),
    C12("C12", "会员卡退卡数据"),
//    C13("C13", "会员卡激活数据"),
    C14("C14", "会员卡补卡换卡数据"),
    C15("C15", "货品操作明细数据"),
//    C16("C16", "利润⽑利数据（移动加权平均）"),
//    C17("C17", "利润⽑利数据（⽉末加权平均）"),
    C18("C18", "场次放映明细数据"),
    C19("C19", "优惠券销售明细数据"),
    C20("C20", "影票订单数据(放映⽇期)"),
//    C21("C21", "⽋款核销明细查询"),
//    C22("C22", "计次卡明细数据")
    ;

    private final String code;
    private final String description;

    DataType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据代码获取枚举值
     * @param code 数据类型代码
     * @return 对应的枚举值，如果未找到则返回null
     */
    public static DataType fromCode(String code) {
        if (code == null) {
            return null;
        }
        for (DataType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
} 